<cpanel include="../../config.php">

<?

/***************************************************************************
 *                                 redirects.php
 *                            -------------------
 *   Begin                : Thursday, April 16, 2005
 *   Copyright            : (C) 2005 Point and Code
 *   Domain               : http://www.pointandcode.com/
 *   Email                : support@pointandcode.com
 *   Version              : 1.0.0
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

$html_root_path = '../../';
$page_title = "Redirects";
include $root_path.'common.php';
include $root_path.'page_header.php';

$template->set_filenames(array(
	'body' => $root_path.$template_path.'files/redirects.tpl')
);

$template->assign_vars(array(
	'S_ACTION' => "redirects_create_done.php",
));



$redirects = <<<EOFpacman
<cpanel Mime="listredirects()">
EOFpacman;

$redirects = explode('</tr>', $redirects);
$array_of_redirects = array();
$i = 0;
foreach ($redirects as $row) {
	$temp = explode('<a href="', $row);
	$temp2 = explode('" target=_blank>', $temp[1]);
	$temp3 = explode('</td>', $temp2[1]);
	$array_of_redirects[$i]['url'] = trim($temp2[0]);
	$array_of_redirects[$i]['path'] = trim($temp3[0]);

	$temp = explode('<td>', $row);
	$temp2 = explode('</td>', $temp[2]);
	$array_of_redirects[$i]['destination'] = trim($temp2[0]);

	$temp2 = explode('</td>', $temp[3]);
	if (trim($temp2[0]) == "(temp)") {
		$array_of_redirects[$i]['type'] = "Temporary";
	} else {
		$array_of_redirects[$i]['type'] = "Permananant";
	};

	if ($array_of_redirects[$i]['url'] != '') {
		$template->assign_block_vars('currentredirectsrow', array(
			'ROWCLASS' => ($i%2) ? $template_cfg['class_row_1'] : $template_cfg['class_row_2'],
			'URL' => $array_of_redirects[$i]['url'],
			'PATH' => $array_of_redirects[$i]['path'],
			'DESTINATION' => $array_of_redirects[$i]['destination'],
			'TYPE' => $array_of_redirects[$i]['type'],
			'U_DELETE' => 'redirects_delete.php?path='.$array_of_redirects[$i]['path'],
			)
		);
		$i++;
	};
};


//
// Woohoo! All done!
//
$template->pparse('body');




include $root_path.'page_tail.php';


?>